<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ page import="com.recommendation.domain.RecommendScope" %>
<%@ page import="com.recommendation.domain.RecommendMode" %>
<%@ taglib prefix="s" uri="/struts-tags"%>
<div>
	<div id='recommendation-status' class='panel' running='<s:property value="running"/>' showcases='<s:property value="showcasesCount"/>'>
		<div class='panel-title'>运行状态</div>
		<div class='panel-content'>
			<div class='msg-stopped red'>自动橱窗推荐未启动或者已停止。</div>
			<div class='msg-running hide'>
				<div><img src='images/ani-gear.gif' /></div>
				<div>自动橱窗推荐正在运行中。</div>
			</div>
			<button class='start'>启动</button>
		</div>
	</div>
	<div id='recommendation-options' class='panel prepend-top'>
		<div class='panel-title'>选项</div>
		<div class='panel-content'>
			<form>
				<table><tbody>
					<tr>
						<td><label for='mode'>推荐模式</label></td>
						<td>
							<div id='mode' value='<s:property value="mode.mode"/>'>
								<input type='radio' name='mode' value='<%=RecommendMode.MODE_FORCE %>' <s:if test='mode.mode == 1'>checked="checked"</s:if>/><span class='strong'>优化模式</span> - 将所有最接近下架时间的宝贝加入橱窗推荐<br />
								<input type='radio' name='mode' value='<%=RecommendMode.MODE_FILL %>' <s:if test='mode.mode == 0'>checked="checked"</s:if>/><span class='strong'>填充模式</span> - 发现橱窗有空缺，则将离下架时间最近的宝贝加入橱窗推荐（无空缺时不推荐宝贝）								
							</div>
						</td>
					</tr>
					<tr>
						<td><label for='scope'>待推荐宝贝范围</label>
						</td>
						<td>
							<div class='scope' type='<s:property value="scope.type"/>'>
								<div><input type='radio' name='scope' value='<%=RecommendScope.TYPE_ALL %>' checked='checked'/>全部宝贝</div>
								<div>
									<input type='radio' name='scope' value='<%=RecommendScope.TYPE_KEYWORD %>'/>含有关键字: 
									<input name="keyword" type='text' class='text' disabled='disabled' value='<s:property value="scope.keyword"/>'/>
									<span class="red">只支持单个关键字</span>
								</div>
								<div><input type='radio' name='scope' value='<%=RecommendScope.TYPE_CATEGORIES %>'/>类别</div>
								<div name="sellerCids" value=='<s:property value="scope.sellerCids"/>' class='categories-selector border hide' style='padding:10px;margin:10px 0;'>
									<!-- option value=''>所有分类</option -->
									<s:iterator value="categories">
										<div value='<s:property value="cid"/>'
											parent='<s:property value="parentCid"/>'
											style=
											<s:if test="%{parentCid != 0}">
												'margin-left:20px;'
											</s:if>
											<s:else>'margin-left:10px;'</s:else>>
											<s:if test="%{parentCid != 0}">└</s:if>
											<input type='checkbox' <s:if test='checked'>checked='checked'</s:if>></input>
											<s:property value="name" />
										</div>
									</s:iterator>
								</div>
								<div><input type='radio' name='scope' value='<%=RecommendScope.TYPE_SPECIFIED %>'/>手动选取</div>
								<div class='items-selector border hide' value='<s:property value="scope.items"/>'>
									<button class='add-item'>添加宝贝</button>
									<div class='selected-items border'>
										<s:iterator value="items">
											<div class="item border left" num_iid='<s:property value="numIid"/>' title='<s:property value="title"/>' style='background: url(<s:property value="picUrl"/>_80x80.jpg) center center no-repeat;'></div>
										</s:iterator>
										<div class='clear'></div>
									</div>
								</div>
							</div>
						</td>
					</tr>
					<tr>
						<td><label for='special'>特殊宝贝设置</label>
						</td>
						<td>
							<div class='special'>
								<div class='must'>
									<div><input type='checkbox' name='must' <s:if test='special.mustItemsEnabled'>checked="checked"</s:if>/>指定<span class='strong red'>必须推荐</span>的宝贝（这些宝贝将一直占用橱窗位，建议少量，否则其他宝贝将缺少被推荐的机会）</div>
									<div class='items-selector hide' value='<s:property value="mustItems"/>'>
										<button class='add-item'>添加宝贝</button>
										<div class='selected-items border'>
											<s:iterator value="mustItems">
												<div class="item border left" num_iid='<s:property value="numIid"/>' title='<s:property value="title"/>' style='background: url(<s:property value="picUrl"/>_80x80.jpg) center center no-repeat;'></div>
											</s:iterator>
											<div class='clear'></div>
										</div>
									</div>
								</div>
								<div class='not'>
									<div><input type='checkbox' name='not'<s:if test='special.notItemsEnabled'>checked="checked"</s:if>/>指定<span class='strong red'>不推荐</span>的宝贝（这些宝贝将不会被推荐，如用于补差价的宝贝）</div>
									<div class='items-selector hide' value='<s:property value="notItems"/>'>
										<button class='add-item'>添加宝贝</button><label> 或者使用关键字：</label><input type='text' class='text' name='notKeyword' value='<s:property value="special.notKeyword"/>'/>
										<div class='selected-items border'>
											<s:iterator value="notItems">
												<div class="item border left" num_iid='<s:property value="numIid"/>' title='<s:property value="title"/>' style='background: url(<s:property value="picUrl"/>_80x80.jpg) center center no-repeat;'></div>
											</s:iterator>
											<div class='clear'></div>
										</div>
									</div>
								</div>
							</div>
						</td>
					</tr>
				</tbody></table>
			</form>
			<button class='save'>保存</button>
			<div class='clear'></div>
		</div>
	</div>
</div>
<div id='add-items-dialog' title='添加宝贝'>
	<s:include value="items-selector.jsp"></s:include>
</div>
<script type="text/javascript" src="js/recommendation.js"></script>